import fetch from 'utils/fetch';
/* 会员管理*/

// 1.经销商购买激活码
export function insertActivationCode(fSchoolId, sSchoolName, membershipChargeId, sPaid, sNumber, sPayable, sUnitPrice, sProportion, sMonth) {
    const data = {
        fSchoolId,
        sSchoolName,
        membershipChargeId,
        sPaid,
        sNumber,
        sPayable,
        sUnitPrice,
        sProportion,
        sMonth
    };
    return fetch({
        url: '/vip/insertActivationCode',
        method: 'post',
        data
    });
}

// 2.获取所有收费设置
export function listMembershipCharge() {
    const data = {
    };
    return fetch({
        url: '/vip/listMembershipCharge',
        method: 'post',
        data
    });
}

// 3.根据经销商用户分页查询激活码订单
export function listActivationCodeByPage(fSchoolId, page, rows) {
    const data = {
        fSchoolId,
        page, 
        rows
    };
    return fetch({
        url: '/vip/listActivationCodeByPage/' + page + '/' + rows,
        method: 'post',
        data
    });
}

// 4.查询激活码详情
export function listActivationCodeDetailByActivationCodeId(fActivationCodeId, sActivationCode, sStatus, sActivationStatus, sGrantPhone, sActivationPhone, page, rows) {
    const data = {
        fActivationCodeId,
        sActivationCode,
        sStatus,
        sActivationStatus,
        sGrantPhone,
        sActivationPhone,
        page, 
        rows
    };
    return fetch({
        url: '/vip/listActivationCodeDetailByActivationCodeId/' + page + '/' + rows,
        method: 'post',
        data
    });
}

// 5.发送激活码
export function updateActivationCodeDetail(fActivationCodeId, pId, sGrantPhone) {
    const data = {
        fActivationCodeId,
        pId,
        sGrantPhone
    };
    return fetch({
        url: '/vip/updateActivationCodeDetail',
        method: 'post',
        data
    });
}

// 6.导出excel模板
export function exportExcel(token) {
    const params = {
        token
    };
    return fetch({
        url: '/vip/exportExcel',
        method: 'get',
        params
    });
}

// 7.导入excel模板
export function batchActivationCodeDetailByGrantPhone(fileName, url, fActivationCodeId) {
    const data = {
        fileName,
        url,
        fActivationCodeId
    };
    return fetch({
        url: '/vip/batchUpdateActivationCodeDetail',
        method: 'post',
        data
    });
}

// 8.确认导入excel
export function confirmBatchUpdate(fActivationCodeId, grantPhones) {
    const data = {
        fActivationCodeId,
        grantPhones
    };
    return fetch({
        url: '/vip/confirmBatchUpdate',
        method: 'post',
        data
    });
}

// 9.按月份统计经销商的订单量等信息
export function getVipOrderStatistics(type, month) {
    const data = {
        type,
        month
    };
    return fetch({
        url: '/order/getVipOrderStatistics',
        method: 'post',
        data
    });
}

// 10.按条件分页查询经销商的订单
export function pageVipOrder(type, page, rows, payPhone, schoolId, payName, payType) {
    const data = {
        type,
        page,
        rows,
        payPhone,
        schoolId,
        payName,
        payType
    };
    return fetch({
        url: '/order/pageVipOrder',
        method: 'post',
        data
    });
}

// 11.获取激活码可用数量
export function getUseNum(fActivationCodeId) {
    const data = {
        fActivationCodeId
    };
    return fetch({
        url: '/vip/getUseNum',
        method: 'post',
        data
    });
}

// 会员订单导出
export function exportVipOrder(token) {
    const params = {
        token
    };
    return fetch({
        url: '/order/exportVipOrder',
        method: 'get',
        params
    });
}

// 分页查询
export function pagePackPayDetail(page,rows,schoolId,payUserPhone,payUserName,payType,packIncrementId) {
    const data = {
        schoolId,
        payUserPhone,
        payUserName,
        payType,
        packIncrementId
    };
    return fetch({
        url: '/vip/pagePackPayDetail/' + page + '/' + rows,
        method: 'post',
        data
    });
}

// 月份查询
export function listPackPayDetail(months) {
    const data = {
        months
    };
    return fetch({
        url: '/vip/listPackPayDetail',
        method: 'post',
        data
    });
}

// 详情
export function getPackPayDetail(id) {
    const data = {
        id
    };
    return fetch({
        url: '/vip/getPackPayDetail',
        method: 'post',
        data
    });
}

// 会员订单导出
export function exportPackPayDetail(token) {
    const data = {
        token
    };
    return fetch({
        url: '/vip/exportPackPayDetail',
        method: 'post',
        data
    });
}

// 查询
export function listProductPackManage() {
    const data = {
        
    };
    return fetch({
        url: '/vip/listProductPackManage',
        method: 'post',
        data
    });
}

